<?php namespace LWJ\Middleware;

use Closure;
use Request;
use App\Services\User\User;
use App\Services\User\Acl;
use Illuminate\Contracts\Auth\Guard;

class ServiceAuthenticate
{
    /**
     * Handle an incoming request.
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if($request->header('app-key')!=env("APP_KEY")) {
            $json['status'] = NO_PERMISSION;
            $json['msg']    = '没有访问权限';
            exit(json_encode($json));
        }
        return $next($request);
    }
}
